package testers;

import java.util.Scanner;

import udpSocket.layerOneClient;
import udpSocket.layerOneServer;

public class TesterLayerOne {


	public static void main(String[] args) throws Exception {
		
		layerOneClient physicalClient = new layerOneClient();
		layerOneServer physicalServer = new layerOneServer();
		
		Scanner in = new Scanner(System.in);
		
		while(true){
			System.out.print("Enter the message to send: ");
			String message = in.nextLine();
			
			System.out.println("");
			System.out.println("Client: Sending message ... ");
			physicalClient.clientSend(message);
			System.out.println("");
			
			System.out.println("Server: Receiving message ... ");
			String msbyserver = physicalServer.serverReceive();
			System.out.println("Server: Message received: "+msbyserver);
			System.out.println("Server: Sending ACK ...");
			physicalServer.serverSend("1");
			
			System.out.println("");
			System.out.println("Client: Receiving ACK ... ");
			String ack = physicalClient.clientReceive();
			System.out.println("Client: Received ACK: "+ack);
			
			System.out.println("");
			System.out.println("Done, starting again ...");
			System.out.println("");
		}
		
	}


}
